<%@ page contentType="text/html; charset=UTF-8" %>
 
<form id="gu_pass_up_form" name="gu_pass_up_form"  class="cmxform" method="POST">
<div class="ui-title re_ui-corner-top re_ui-helper-clearfix">个人管理->修改密码</div>
<div class="tableBox">
<div class="contentbox">

<div  id="userx_dialog_look" class="scroll" style="height:400px; overflow-y:auto">
<div id="userx_update_pwd_errmsg"></div>

<!-- 基本信息 -->
 
<!-- 其它信息 -->     
     
<fieldset>
	<legend>修改密码</legend>
        <table width="50%" align="center" border="0" cellspacing="0" cellpadding="0" class="jkt-tableStyle">
	 
	<tr>
         
         <td class="bluetd" align="right">当前密码：</td>
        <td class="bluetd" align="left">
          <input id="user_password_now" name="user_password_now" type="password"  value=""/>
        </td>
     </tr>
     <tr>   
        <td class="bluetd" align="right">新密码：</td>
        <td class="bluetd" align="left">
          <input id="user_password_new" name="user_password_new"  type="password" value=""/>
        </td>
     </tr>
     <tr>   
        <td class="bluetd" align="right">确认新密码：</td>
        <td class="bluetd" align="left">
          <input id="user_password_new2" name="user_password_new2"  type="password" value=""/>
        </td>
     </tr>
	 
   
	
</table>
</fieldset>    
<div style="text-align:center">          
<input type="button" class="btns" id="user_update_bt" value="修-  改" style="margin-top:8px;" />&nbsp;&nbsp;
          <input type="reset" class="btns" value="重  置" style="margin-top:8px;" />&nbsp;&nbsp;
          </div>

</div>
</div>
</div>

</form>
<script>
   
     


     $('#user_update_bt').click(function(){//点击按妞
        
         if(rulesByValidator(userupvalidate)){
             userx_uppass_submit();
         }
     })
     
  
   var userupvalidate;
     userupvalidate = $("#gu_pass_up_form").validate({
            //errorLabelContainer: $("#role_addform div.notification_false"),
            errorElement: "div",
            errorPlacement: function(error, element) {
			    $('#userx_update_pwd_errmsg').html("");
				error.appendTo( "#userx_update_pwd_errmsg" );
			},
			success: function(label) {
			    label.text("验证通过!").removeClass("error").addClass("success");
			},
            rules: {
				user_password_now:{
                    required: true,
                    remote: {
                       url: "system/User/checkPassword.do",
                       type: "post",
                       contentType: "application/x-www-form-urlencoded; charset=UTF-8",
                       data: {password: function() {
                           return $("#user_password_now").val()}
                       }
                   }
                   
               },
               user_password_new:{
                    required: true,
                    stringMinLength:6
               },
               user_password_new2: {
					required: true,
					equalTo: "#user_password_new"
				}
			 
            },
            messages: {
            	user_password_now:{
            	required: "当前密码不能为空",
            	remote: "当前密码输入错误"
	        	 },
			    user_password_new:{
	         		required: "新密码不能为空",
	         		stringMinLength:"密码长度不能小于6位"
	      		},
				user_password_new2:{
	         		required: "确认新密码不能为空",
	         		equalTo: "确认新密码与新密码不一致"
	     		}
				 
            },
            //onfocusout:false,
            onkeyup:false,
	        onsubmit:false
        })
	
     
	
     
    function  userx_uppass_submit(){//修改提交
         var userxJson="{'id':'"+$('#userx_id_look').val()+"','password':'"+$('#user_password_now').val()+"','passwordNew1':'"+$('#user_password_new').val()+"','passwordNew2':'"+$('#user_password_new2').val()+"'}";  
         $.ajax({
             type: "POST",
             url:"system/User/updatePassword.do",
             data:{
                 userJson:userxJson
             },
             dataType: "json",
             contentType: "application/x-www-form-urlencoded; charset=UTF-8",
             success:function(json){
                 if(json.success){
                     $("#userx_grid").trigger("reloadGrid");
                     alertmsg(json.msg,"info");
                 }else{
                     alertmsg(json.msg,"alert");
                 }
                 //关闭当前窗口
                // colseTab();
             }
        })
     }
     
     
 
 
     
     
     

</script>